<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>电商</title>
</head>

<link rel="stylesheet" type="text/css" href="/tpshop2/Public/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/tpshop2/Public/css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="/tpshop2/Public/css/front.css">
<body id="product_lists">
	<div class="container">
		<div class="row" id="header">
			<div class="col-md-3">
			<a href="<?php echo U()?>"><img  class="logo" src="/tpshop2/Public/img/logo.jpg"></a>
			</div>
			<div class="col-md-6">
					<p id="contact"><i class="glyphicon glyphicon-phone-alt"></i>400-12345678910<i class="glyphicon glyphicon-envelope"></i>shop@goodjobs.cn</p>
				 <div class="input-group">
			      <input type="text" class="form-control" placeholder="请输入商品名称或编号...">
			      <span class="input-group-btn">
			        <button class="btn btn-info" type="button">搜索</button>
			      </span>
			    </div>
			</div>
			<div class="col-md-3 user_header">
				<?php if($_SESSION['user_is_login']){?>
					<span>欢迎你，<?=$_SESSION['user_name']?></span><a href="<?=U("user/logout");?>">退出</a>
				<?php }else{?>
				<a href="<?=U('user/login')?>">请登录</a>
				<a href="<?=U('user/regedit')?>">请注册</a>
				<?php }?>
				<a href="<?=U('Shopping/cartList');?>" class="shopcart pull-right">
				
					<i class=" glyphicon glyphicon-shopping-cart "></i>我的购物车
					<?php if($_SESSION['user_is_login']){?>
					<span>2322</span>
					<?php }?>
				</a>
			</div>
		</div>     
		<br/><br/>
		<div class="row">
			<div class="col-md-3">
				<div id="product_menu">
					<div id="product_menu_title"><?=$parent_catalog['name']?></div>
					<ul>
						<?php foreach($brother_catalogs as $c){?>
						<li <?php if($c['id'] == $catalog['id']){?> class="active" <?php }?>><a href="<?= U('home/product/lists/cataid/'.$c['id'])?>"><?=$c['name']?></a></li>
						<?php }?>
					</ul>
				</div>
			</div>
			<div class="col-md-9">
				<div class="row">
					<div class="col-md-12">
						<?php
 foreach($brands as $b){?>
							<a href="<?php echo U()."?brand=".$b->id?>"><?=$b->name?></a>
						<?php }?>
					</div>
				</div>
					
					<div class="row">
						<?php foreach($products as $p){?>
						<div class="col-md-3 product_item">
							<img style="height:100px;" class="product_item_img" src="/tpshop2<?=$p['img']?>">
							<?php $imgs = M('product_img')->where('product_id='.$p['id'])->limit(4)->select();?>
							<ul class="clearfix">
								<?php foreach($imgs as $img){?>
								<li><img style="height:100px;" src="/tpshop2<?=$img['url']?>"/></li>
								<?php }?>
							</ul>
							<h5><?=$p['title']?></h5>
							<p class="price">￥<?=$p['price']?></p>
							<a href="<?=U('home/product/detail/id/'.$p->id)?>" class="btn btn-danger">立即购买</a>
						</div>
						<?php }?>
					</div>

				</div>
			</div>
		</div>
				<script type="text/javascript" src="/tpshop2/Public/js/jquery.js"></script>
				<script type="text/javascript">
				    $(function() {
				    	$('.product_item ul li').mouseover(function(){
				    		$(this).parents('.product_item').find('ul li').removeClass("hover");
				    		$(this).addClass('hover');
				    		var src  = $(this).find('img').attr('src');
				    		$(this).parents('.product_item').find('.product_item_img').attr('src',src);
				    		
				    	})
				    })
				</script>
	
</body>
</html>